// 文件上传相关接口
import r from '@/utils/request';
import { type ResponseType } from './types';

enum API {
  add = '/upload/add'
}

export type UploadRes = ResponseType<{
  url: string;
}>;

export const uploadUrl = import.meta.env.VITE_API_BASE_URL + API.add;

// 文件上传参数类型是FormData
export function uploadAPI(data: FormData): Promise<UploadRes> {
  return r.post(API.add, data);
}
